<div class="main-content" id="main-content">
	<div class="sub-content">
		<div class="top-header">
			<h1>Sell Offer Info</h1>
		</div>
		<div class="top-links">
			<ul>
				<li class="active-menu"><a href="/products/add-product"><span>1</span></a></li>
				<li><span>2</span></li>
				<li><span>3</span></li>
			</ul>
		</div>
		<div class="middle-forms">
			<form id="forms" method="post">
				<div class="sub-forms">
					<div class="forms-list">
						<label>Brand/Grade No</label>
						<? if(isset($_SESSION['products']['brand']) && $_SESSION['products']['brand']!=""){?>
							<input type="text" value="<? echo $_SESSION['products']['brand'];?>" id="brand" name="brand" placeholder="eg Acranol 290D" />
						<?}else if(isset($this->productsDeatils->brandcode) && $this->productsDeatils->brandcode!=""){?>
							<input type="text" value="<?php echo $this->productsDeatils->brandcode;?>" id="brand" name="brand" placeholder="eg Acranol 290D" />
						<?}else{?>
							<input type="text" value="" id="brand" name="brand" placeholder="eg Acranol 290D" />
						<?}?>
					</div><span style="color:red" id="errorbrand"></span>
					<div class="forms-list">
						<label>Generic Name</label>
						<? if(isset($_SESSION['products']['generic']) && $_SESSION['products']['generic']!=""){?>
							<input type="text"  value="<?php echo $_SESSION['products']['generic'];?>" id="generic" name="generic" placeholder="eg Styrene Acrylic Emulsion" />
						<?}else if(isset($this->productsDeatils->genericname) && $this->productsDeatils->genericname!=""){?>
							<input type="text"  value="<?php echo $this->productsDeatils->genericname;?>" id="generic" name="generic" placeholder="eg Styrene Acrylic Emulsion" />
						<?}else{?>
							<input type="text"  value="" id="generic" name="generic" placeholder="eg Styrene Acrylic Emulsion" />
						<?}?>
					</div><span style="color:red" id="errorgname"></span>
					<div class="forms-list">
						<label>Fuction</label>
						<? if(isset($_SESSION['products']['fuction']) && $_SESSION['products']['fuction']!=""){?>
							<input type="text"  value="<?php  echo $_SESSION['products']['fuction'];?>" id="fuction" name="fuction" placeholder="eg Binder, Defoamer, Biocide" />
						<?}else if(isset($this->productsDeatils->fuction) && $this->productsDeatils->fuction!=""){?>
							<input type="text"  value="<?php  echo $this->productsDeatils->fuction;?>" id="fuction" name="fuction" placeholder="eg Binder, Defoamer, Biocide" />
						<?}else{?>
							<input type="text"  value="" id="fuction" name="fuction" placeholder="eg Binder, Defoamer, Biocide" />
						<?}?>
					</div><span style="color:red" id="errorfunction"></span>
					<div class="forms-list">
						<label>Manufacturer</label>
						<? if(isset($_SESSION['products']['manufacture']) && $_SESSION['products']['manufacture']!=""){?>
							<input type="text" value="<?php echo $_SESSION['products']['manufacture'];?>" id="manufacture" name="manufacture" placeholder="eg BASF" />
						<?}else if(isset($this->productsDeatils->manufacturer) && $this->productsDeatils->manufacturer!=""){?>
							<input type="text" value="<?php echo $this->productsDeatils->manufacturer;?>" id="manufacture" name="manufacture" placeholder="eg BASF" />
						<?}else{?>
							<input type="text" value="" id="manufacture" name="manufacture" placeholder="eg BASF" />
						<?}?>
					</div><span style="color:red" id="errormanufacture"></span>
					<div class="forms-list">
						<label>Origin</label>
						<div class="select_6">
							<select id="origin" name="origin">
								<option value="">-Select a Origin</option>	
								<?php if(isset($getCountries) && count($getCountries)>0){foreach($getCountries as $countries){ 								
								if($_SESSION['products']['origin']==$countries->country_id){?>
									<option value="<? echo $countries->country_id;?>" selected="selected"><? echo $countries->nicename;?></option> 
								<?}else if($this->productsDeatils->origin_country==$countries->country_id){?>
									<option value="<? echo $countries->country_id;?>" selected="selected"><? echo $countries->nicename;?></option> 
								<?}else{?>
									<option value="<? echo $countries->country_id;?>"><? echo $countries->nicename;?></option> 
								<?}}}?>
							</select>
						</div>
					</div><span style="color:red" id="errororigin"></span>
					<div class="forms-list">
						<label>Categories</label>
						<div class="select_6">
							<select id="category_id" name="category_id">
								<option value="">-Select Category</option>
								<? if(count($this->getallcategories)!=0){foreach($this->getallcategories as $categories){?>
								<?php if(isset($_SESSION['products']['category_id'])){ 
								if($_SESSION['products']['category_id']==$categories->category_id){?>
									<option value="<? echo $categories->category_id;?>" selected="selected"><? echo $categories->category_name;?></option> 
								<?}}else if(isset($this->productsDeatils->category_id)){ if($this->productsDeatils->category_id==$categories->category_id){?>
									<option value="<? echo $categories->category_id;?>" selected="selected"><? echo $categories->category_name;?></option> 
								<?}}else{?>
									<option value="<? echo $categories->category_id;?>"><? echo $categories->category_name;?></option> 
								<?}}}?>								    
							</select>
						</div>
					</div><span style="color:red" id="errorcategory"></span>
					<input type="hidden" id="hid_product_id" name="hid_product_id" value="<? if(isset($_GET['product_id'])){ echo $_GET['product_id'];}?>"/>
					<div class="forms-list">
						<button onclick="return submitValues()">Continue</button>
					</div>
				</div>
			</form>
		</div>
	 </div>
</div> 
<script>
	function submitValues(){
	    var flag=true;	
		var letters = /^[a-zA-Z ]*$/; 
		var numbers = /^[0-9]+$/;
		var brand=$('#brand').val();
		var generic=$('#generic').val();
		var fuction=$('#fuction').val();
		var manufacture=$('#manufacture').val();
		var origin=$('#origin').val();
		var category=$('#category_id').val();
		if(brand==""){
			$('#errorbrand').html('*Please enter brand/grade number');	
			flag=false;
		}else{
			$('#errorbrand').html('');
		}
		
		if(generic==""){
			$('#errorgname').html('*Please enter generic name');	
			flag=false;
		}else{
			$('#errorgname').html('');
		}
		if(fuction==""){
			$('#errorfunction').html('*Please enter function');
			flag=false;
		}else{
			 $('#errorfunction').html('');
		}
		if(manufacture==""){
			$('#errormanufacture').html('*Please enter manufacturer');
			flag=false;
		}else{
			 $('#errormanufacture').html('');
		}
        if(origin==""){
			$('#errororigin').html('*Please select origin');
			flag=false;
		}else{
			 $('#errororigin').html('');
		}
		if(category==""){
			$('#errorcategory').html('*Please select category');
			flag=false;
		}else{
			 $('#errorcategory').html('');
		}
		if(flag==false){ 
			return false;
		}else{		
			$("#forms").submit();
		}
	}
</script>